package org.mathcloud.math.core.maple.operator.algebra;

//import classes slf4j
import org.mathcloud.math.core.maple.factory.MapleQuantityObjectFactory;
import org.mathcloud.math.core.maple.manager.MapleSupervisor;
import org.mathcloud.math.core.maple.operator.MapleNaryOperator;
import org.mathcloud.math.core.maple.quantity.MapleQuantityObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.mathcloud.math.core.common.operator.algebra.Times;
import org.mathcloud.math.core.common.quantity.QuantityObject;

public class MapleTimes extends MapleNaryOperator implements Times
{
	@Override
	public QuantityObject calculate(QuantityObject operand1, QuantityObject operand2)
	{
		try {
			MapleQuantityObject tOp1 = MapleQuantityObjectFactory.getInstance(operand1);
			MapleQuantityObject tOp2 = MapleQuantityObjectFactory.getInstance(operand2);
			String mapleJob = MapleJob(".", tOp1, tOp2, true);				
			log.debug(mapleJob);			
			return MapleQuantityObjectFactory.getInstance(getResultSignature(tOp1,tOp2), MapleSupervisor.getMapleEngine().evaluate(mapleJob));
		} 
		catch (Exception e) {
			log.error("Exception", e);
		}
		return null;
	}
	private static final Logger log = LoggerFactory.getLogger(MapleTimes.class);	
}
